package com.edu.web.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.edu.entity.Reason;
import com.edu.entity.YuanC;
import com.edu.service.impl.UserServiceImpl;

/**
 * Servlet implementation class YuanQueryServlet
 */
@WebServlet("/YuanQueryServlet")
public class YuanQueryServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		 request.setCharacterEncoding("UTF-8");
		 YuanC re =new YuanC();
		 if(!(request.getParameter("id").equals(""))) {
			 re.setId(Integer.parseInt(request.getParameter("id")));
			}
		 if(!(request.getParameter("moneys").equals(""))) {
			 re.setCollect(Integer.parseInt(request.getParameter("moneys")));
			}
		 if(!(request.getParameter("money").equals(""))) {
			 re.setTargets(Integer.parseInt(request.getParameter("money")));
			}
		 re.setAuthor(request.getParameter("zuoz"));
		 re.setTheme(request.getParameter("biaot"));
		 re.setTitle(request.getParameter("qian"));
		 UserServiceImpl userServiceImpl=new UserServiceImpl();
		 request.setAttribute("Reason",userServiceImpl.queryByAYuan(re));
		 request.getRequestDispatcher("manage-Yuan.jsp").forward(request, response);
		
		 
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
